package cn.edu.scau.cmi.chenmiaopeng.compositePattern.transparentPattern;

public class Personal_T extends Organization_T{
//  private String name;
  private String ERRMESSAGE0 = "The add operation for individual is not supported!";
  private String ERRMESSAGE1 = "The remove operation for individual is not supported!";
  private String ERRMESSAGE2 = "The getChild operation for individual is not supported!";
  public Personal_T(String name) {
	  this.name = name;
  }
  public void setName(String name) {
	  this.name = name;
  }
  public String getName() {
	  return name;
  }
  public String greet() {
	  return "Hello, I'm "+name+"!";
  }
  public String getOrganization(int instanceIndex) {
	  return ERRMESSAGE2;
  }
  public String add(String instanceName) {
	  return ERRMESSAGE0;
  }
  public String remove(String instanceName) {
	  return ERRMESSAGE1;
  }
  public boolean equals(Object other) {
	  if(other==null) return false;
	  else if(other instanceof Personal_T) {
		  return false;
	  }
	  else {
		  Personal_T otherPerson = (Personal_T)other;
		  if(name.equals(otherPerson.getName())) {
			  return true;
		  }
		  else return false;
	  }
  }
}
